<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var uploadStart = (function () {

            var id = 0;
            return function (fileType,files) {
                for(var i = 0,file;file = files[i++];){
                    let upload = new Upload(fileType,file.fileName,file.fileSize)
                    upload.init(id++)
                }
            }
        })()

        class Upload {
            constructor(fileType,fileName,fileSize) {
                this.fileType = fileType;
                this.fileName = fileName;
                this.fileSize = fileSize;
                this.dom = null;
                this.id = null;
            }
            init(id) {
                var that = this
                this.id = id
                this.dom = document.createElement("div")
                this.dom.innerHTML = `<span>文件明:</span>${this.fileName}
                <span>文件大小：</span>${this.fileSize}<button class="del">删除</button>`
                this.dom.querySelector(".del").onclick = function () {
                    that.delFile()
                }
                document.body.appendChild(this.dom)
            }
            delFile() {
                if(this.fileSize < 3000) {
                    return this.dom.parentNode.removeChild(this.dom)
                }
                if(window.confirm(`是否删除${this.fileName}文件?`)) {
                    return this.dom.parentNode.removeChild(this.dom)
                }
            }
        }

        uploadStart( 'plugin', [
            {
              fileName: '1.txt',
              fileSize: 1000
            },
            {
              fileName: '2.html',
              fileSize: 3000
            },
            {
              fileName: '3.txt',
              fileSize: 5000
            }
        ]);
        uploadStart( 'flash', [
            {
              fileName: '4.txt',
              fileSize: 1000
            },
            {
              fileName: '5.html',
              fileSize: 3000
            },
            {
              fileName: '6.txt',
              fileSize: 5000
            }
        ]);
    </script>
</body>
</html>